<template>
  <div>
    <el-card class="box-card">
      <div slot="header" class="clearfix">
        <span>登录</span>
        </div>
        <div class="text item" >
        <el-form
          :model="ruleForm" 
          status-icon
          ref="ruleForm"
          label-width="100px"
          class="demo-ruleForm"
        >
          <el-form-item label="账号">
            <el-input type="text" v-model="ruleForm.userName"></el-input>
          </el-form-item>
          <el-form-item label="密码">
            <el-input type="password" v-model="ruleForm.userPass"></el-input>
          </el-form-item>

          <el-form-item>
            <el-button type="primary" @click="submitForm('ruleForm')">登录</el-button>
            </el-form-item>
        </el-form>
        </div>
      
    </el-card>
  </div>
</template>

<script>

export default {
  data() {
    return {
      ruleForm: {
        
      },
    };
  },
  methods: {
    async submitForm() {
      var response = await this.ajax.postSubmit("/project/users/login",{userName:this.ruleForm.userName,userPass:this.ruleForm.userPass});
      if(response.status == 1){
          this.$router.push("/demoList")
      } else {
          var info = response.data
          this.$message(info);
      }
      
    },
    
  },
};
</script>

<style>
  .text {
    font-size: 14px;
  }

  .item {
    margin-bottom: 18px;
  }
.box-card {
    margin: auto;
    width: 480px;
  }
</style>